home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / stkr3dmo.zoo / stkr3dmo / demo.bts < prev    next >
Text File  |  1991-11-15  |  12KB  |  380 lines

  1. // STalker 3 script file for disabled demo
  2.  
  3.  
  4. include "stalker.bth"       // definitions for built-in functions
  5.  
  6. function show_fkeys()       // show function key assignments
  7.   string  buffer[80];
  8.   int   i;
  9.  
  10.   i = 0;
  11.   repeat
  12.     set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);  // display controls
  13.     printf("fkey%02d = \"%s\"", i + 1,
  14.          get_string_param(FKEY_PARAM, i, buffer, sizeof(buffer)));
  15.     set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  16.     puts("\r\n");
  17.   until (i = i + 1) >= 20;
  18.   putchar('\n');
  19. endfunction
  20.  
  21.  
  22. function show_logon(
  23.   int   entry_num
  24.   )                         // display the automatic logon entries
  25.   int   i;
  26.   int   print_title;
  27.   string  prompt[10];
  28.   string  response[30];
  29.  
  30.   print_title = TRUE;
  31.   i = 0;
  32.   repeat
  33.     get_string_param(DIALER_LOGON_PARAM, entry_num + ((DIALER_LG_PROMPT + i) << 16), prompt, sizeof(prompt));
  34.     if get_int_param(DIALER_LOGON_PARAM, entry_num + ((DIALER_LG_HIDDEN + i) << 16)) then
  35.       strcpy(response, "«Hidden»");     // it's a hidden string (password)
  36.     else
  37.       get_string_param(DIALER_LOGON_PARAM, entry_num + ((DIALER_LG_RESPONSE + i) << 16), response, sizeof(response));
  38.     endif
  39.     if prompt[0] OR response[0] then
  40.       if print_title then
  41.         puts("        Prompt     Response\r\n");
  42.         puts("        ---------  -----------------------------\r\n");
  43.         print_title = FALSE;
  44.       endif
  45.       set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  46.       printf("        %-11.9s%s", prompt, response);
  47.       set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  48.       puts("\r\n");
  49.     endif
  50.   until (i = i + 1) >= 8;
  51.   putchar('\n');
  52. endfunction
  53.  
  54.  
  55. function show_dialer()      // display autodialer entries
  56.   int   group;
  57.   int   i;
  58.   int   count;
  59.   string  name[20];
  60.   string  number[20];
  61.   string  script[10];
  62.  
  63.   i = 0;
  64.   count = 0;
  65.   repeat
  66.     get_string_param(DIALER_NAME_PARAM, i, name, sizeof(name));
  67.     get_string_param(DIALER_NUMBER_PARAM, i, number, sizeof(number));
  68.  
  69.     if name[0] OR number[0] then
  70.       if (count = count+1) == 1 then        // only the first time around
  71.         puts("BBS/Service Name     Group     Phone Number      $$/Hr  Limit   Script\r\n");
  72.         puts("-------------------  -----  -------------------  -----  -----  --------\r\n");
  73.       endif
  74.       group = get_int_param(DIALER_GROUP_PARAM, i);
  75.       if group < 0 then
  76.         group = ' ';
  77.       else
  78.         group = group + '0';
  79.       endif
  80.       get_string_param(DIALER_SCRIPT_PARAM, i, script, sizeof(script));
  81.       printf("%-23.19s%c    %-19.19s  %2d.%02d  %2d.%02d  %s\r\n",
  82.            name, group, number,
  83.            get_int_param(DIALER_COST_PARAM, i) / 100, get_int_param(DIALER_COST_PARAM, i) % 100,
  84.            get_int_param(DIALER_LIMIT_PARAM, i) / 100, get_int_param(DIALER_LIMIT_PARAM, i) % 100,
  85.            script
  86.           );
  87.  
  88.       show_logon(i);
  89.     endif
  90.   until (i = i + 1) >= 30;
  91.   if count == 0 then        // no entries
  92.     puts("Oh, it doesn't look like you have any dialer entries set.\r\n");
  93.   endif
  94. endfunction
  95.  
  96.  
  97. function show_modem()       // show the modem configuration settings
  98.   string  buf[80];
  99.   int   i;
  100.  
  101.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  102.   printf("Modem Init: «%s»", get_string_param(MDM_INIT_PARAM, 0, buf, sizeof(buf)));
  103.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  104.   puts("\r\n");
  105.  
  106.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  107.   printf("    Prefix: «%s»", get_string_param(MDM_PREFIX_PARAM, 0, buf, sizeof(buf)));
  108.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  109.   puts("\r\n");
  110.  
  111.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  112.   printf("    Suffix: «%s»", get_string_param(MDM_SUFFIX_PARAM, 0, buf, sizeof(buf)));
  113.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  114.   puts("\r\n");
  115.  
  116.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  117.   printf("    Hangup: «%s»", get_string_param(MDM_HANGUP_PARAM, 0, buf, sizeof(buf)));
  118.   set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  119.   puts("\r\n");
  120.  
  121.   i = 0;
  122.   repeat
  123.     set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  124.     printf("  Connect%d: «%s»", i + 1, get_string_param(MDM_CONNECT_PARAM, i, buf, sizeof(buf)));
  125.     set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  126.     puts("\r\n");
  127.   until (i = i + 1) >= 2;
  128.  
  129.   i = 0;
  130.   repeat
  131.     set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
  132.     printf("     Fail%d: «%s»", i + 1, get_string_param(MDM_FAILURE_PARAM, i, buf, sizeof(buf)));
  133.     set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
  134.     puts("\r\n");
  135.   until (i = i + 1) >= 4;
  136.  
  137.   printf("Use DCD: %d   Use DTR: %d   Character Delay: %d\r\n",
  138.        get_int_param(MDM_USE_DCD_PARAM, 0), get_int_param(MDM_USE_DTR_PARAM, 0),
  139.        get_int_param(MDM_DELAY_PARAM, 0));
  140. endfunction
  141.  
  142.  
  143. function show_path()    // display STalker's file paths
  144.   string  buf[256];
  145.  
  146.   printf("Download Path: %s\r\n", get_string_param(PATH_PARAM, PATH_DOWNLOAD, buf, sizeof(buf)));
  147.   printf("  Script Path: %s\r\n", get_string_param(PATH_PARAM, PATH_SCRIPT  , buf, sizeof(buf)));
  148.   printf(" General Path: %s\r\n", get_string_param(PATH_PARAM, PATH_GENERAL , buf, sizeof(buf)));
  149.   printf("   Scrap Path: %s\r\n", get_string_param(PATH_PARAM, PATH_SCRAP   , buf, sizeof(buf)));
  150. endfunction
  151.  
  152.  
  153. function waitkey()      // wait for a key to be pressed
  154.   puts( "\r\n\r\nPress any key to continue..." );
  155.   getchar();
  156. endfunction
  157.  
  158.  
  159. function show_settings()    // show all of the settings
  160.   puts( "\033ETo start with, here are the function key strings:\r\n\n" );
  161.   show_fkeys();
  162.   waitkey();
  163.   puts( "\033EAnd here are your autodialer settings:\r\n\n" );
  164.   show_dialer();
  165.   waitkey();
  166.   puts( "\033EThis is the modem configuration:\r\n\n" );
  167.   show_modem();
  168.   waitkey();
  169.   puts( "\033EAnd these are the current paths:\r\n\n" );
  170.   show_path();
  171.   waitkey();
  172. endfunction
  173.  
  174. //  Test all of the possible colour combinations allowed by
  175. //  VT52 and VT100/ANSI emulations.
  176. function show_colors()
  177.   int   orig_emulation;
  178.   string  s;
  179.  
  180.   orig_emulation = get_emulation();     // save emulation
  181.   s = "This text is being written with the colour set to ";
  182.  
  183.   set_emulation(EMUL_VT52);     // force to VT-52
  184.  
  185.   puts("\033E\t\t\033b1\033p        VT52 Mode        \033q\r\n");
  186.   printf("\033b0%sWHITE\r\n", s);
  187.   printf("\033b1%sBLACK\r\n", s);
  188.   printf("\033b2%sRED\r\n", s);
  189.   printf("\033b3%sGREEN\r\n", s);
  190.   printf("\033b4%sBLUE\r\n", s);
  191.   printf("\033b5%sCYAN\r\n", s);
  192.   printf("\033b6%sYELLOW\r\n", s);
  193.   printf("\033b7%sMAGENTA\r\n", s);
  194.   printf("\033b8%sLIGHT WHITE (LIGHT GREY)\r\n", s);
  195.   printf("\033b9%sLIGHT BLACK (GREY)\r\n", s);
  196.   printf("\033b:%sLIGHT RED\r\n", s);
  197.   printf("\033b;%sLIGHT GREEN\r\n", s);
  198.   printf("\033b<%sLIGHT BLUE\r\n", s);
  199.   printf("\033b=%sLIGHT CYAN\r\n", s);
  200.   printf("\033b>%sLIGHT YELLOW\r\n", s);
  201.   printf("\033b?%sLIGHT MAGENTA\r\n", s);
  202.  
  203.  
  204.   puts("\n\t\t\033b1\033p     VT100/ANSI Mode     \033q\r\n");
  205.   set_emulation(EMUL_VT100);
  206.  
  207.   printf("\23337m%sWHITE\r\n", s);
  208.   printf("\23330m%sBLACK\r\n", s);
  209.   printf("\23331m%sRED\r\n", s);
  210.   printf("\23332m%sGREEN\r\n", s);
  211.   printf("\23333m%sYELLOW\r\n", s);
  212.   printf("\23334m%sBLUE\r\n", s);
  213.   printf("\23335m%sMAGENTA\r\n", s);
  214.   printf("\23336m%sCYAN\r\n", s);
  215.  
  216.   printf("\23330m");  // Restore colour to BLACK
  217.  
  218.   set_emulation(orig_emulation);    // restore emulation
  219. endfunction
  220.  
  221. //  Tests the play_sound() builtin function.
  222. function show_tunes()
  223.     string  buffer[80];
  224.  
  225.     puts("\033E");
  226.     while TRUE do
  227.         puts("Sound number to play (0-5, Return to exit) -> ");
  228.         if gets(buffer, sizeof(buffer)) <= 0 then
  229.             return;
  230.         endif
  231.         play_sound(atoi(buffer));
  232.     endwhile
  233. endfunction
  234.  
  235.  
  236. //  Copy a file to the STalker terminal window.
  237. function show_file(string file)
  238.     string  buffer[256];
  239.     int     fd;
  240.  
  241.     if (fd = file_open(file, 0)) < 0 then
  242.         printf("Error %d opening '%s'\r\n", fd, file);
  243.         return;
  244.     endif
  245.  
  246.     while file_gets(buffer, sizeof(buffer), fd) > 0 do
  247.